const BlogType = require("./models/BlogType");
const Blog = require("./models/Blog");
const CommentModel = require("./models/commentModel");

// 文章和文章列表
BlogType.hasMany(Blog, {
    foreignKey: 'categoryId',
});
Blog.belongsTo(BlogType, {
    foreignKey: "categoryId",
    as: "category",
});

// 文章和文章评论
Blog.hasMany(CommentModel, {
    foreignKey: "blogId",
})

CommentModel.belongsTo(Blog, {
    foreignKey: "blogId"
})